Release 10.1A: OpenEdge Development:
Java Open Clients


Defining the schema for temp-tables in a ProDataSet

Defining the schema for a temp-table (ProDataObject collection) in a ProDataSet is a multi-step process.

Note: This is a condensed description with reference to the Java OpenAPI. For complete information on defining the schema temp-tables in a ProDataSet parameter, see Chapter 5, " Accessing Progress ProDataSets."

To define the schema for a temp-table in a ProDataSet:

  1. Define a com.progress.open4gl.ProDataObjectMetaData object to hold the schema.
  2. Add field descriptions to the ProDataObjectMetaData object.
  3. Add the ProDataObjectMetaData object to the ProDataGraphMetaData for the ProDataSet.
Defining a ProDataObjectMetaData object

For each table (ProDataObject collection) contained within a ProDataGraph, you must define a com.progress.open4gl.ProDataObjectMetaData object to hold the schema using the following constructor:

Syntax
public ProDataObjectMetaData (String tableName, int numFields,  
                              boolean bimageFlag, int numIndexes, 
                              String multiIxCols, 
                              String XMLNamespace, String XMLPrefix) 

tableName

Specifies a name for the specified ProDataObject type (and collection). This name is typically identical to any 4GL temp-table to which this collection is mapped.

numFields

Specifies the number of fields (column properties) in the specified ProDataObject type.

bimageFlag

Specifies true if the corresponding Progress 4GL temp-table is defined with the BEFORE-TABLE option, indicating that the temp-table (and hence the ProDataObject collection) can be modified. Otherwise, this value must be false and you cannot pass modified data between the Open Client and the AppServer.

numIndexes

Specifies the number of indexes on the table.

multiIxCols

Specifies null if there are no indexes or a formatted string that contains all the index info for this temp-table, as follows:

Syntax
"[primeUniqueFlag,primeFld1[,primeFldn]...:primeIdxName.] 
[uniqueIdxfld1[,uniqueIdxfldn]...:uniqueIdxName.]..." 

For more information on this formatted string, see the section on the ProDataObjectMetaData() constructor in Chapter 5, " Accessing Progress ProDataSets."

XMLNamespace

Specifies the namespace for XML serialization or null.

XMLPrefix

Specifies the prefix for XML serialization or null.

Adding field descriptions to the ProDataObjectMetaData object

For each field (ProDataObject column property) in the temp-table, add its meta data by calling the setFieldMetaData() method on the ProDataObjectMetaData object:

Syntax
public void setFieldMetaData (int fieldNumber, String fieldName,  
                              int extentValue, int proType,  
                              int userOrder, int xmlMapping) 

fieldNumber

Specifies a 1-based position that corresponds to the position of a mapped field in a Progress 4GL temp-table.

fieldName

Specifies a name that is typically identical to a mapped field in the corresponding 4GL temp-table. The value cannot be null and must be unique among fields (column properties) in the specified ProDataObject type.

extentValue

Specifies if and how the field represents an array field in the corresponding temp-table. The value must be 0 or greater. If the value is greater than 1, this column property is many-valued (represents an array field) and the value is its extent. If the property represents a BLOB or CLOB field, the value must be 0 or 1.

proType

Specifies the value of a class constant defined in the com.progress.open4gl.Parameter class. The specified class constant indicates the 4GL data type of the mapped temp-table field. For more information on these class constants, see the sections on specifying field data type meta data for temp-tables in Chapter 4, " Passing Parameters." To identify the Java data type that the column property assumes for the specified 4GL data type, see the information on managing ProDataObject mappings to temp-tables in Chapter 5, " Accessing Progress ProDataSets."

userOrder

Specifies a 0-based user order position for the column property.

xmlMapping

Reserved for future use.  Always specify 0.

Adding the ProDataObjectMetaData object to the ProDataGraphMetaData

Add the ProDataObjectMetaData object to the ProDataGraphMetaData using the following ProDataGraphMetaData object method:

Syntax
public void addTable(ProDataObjectMetaData doMetaData) 

doMetaData

Specifies the ProDataObjectMetaData for one temp-table in the ProDataSet parameter.

This is an example that adds a temp-table parameter defined with no indexes:

Sample OpenAPI fragment adding a temp-table parameter
// Create the ProDataObjectMetaData for the Customer table 
ProDataObjectMetaData doCustMD = new ProDataObjectMetaData  
                                 ("ttCust", 3, false, 0, null, null, null); 
doCustMD.setFieldMetaData (1, "CustNum",  0, Parameter.PRO_INTEGER, 0, 0); 
doCustMD.setFieldMetaData (2, "Name",     0, Parameter.PRO_CHARACTER, 1, 0); 
doCustMD.setFieldMetaData (3, "SalesRep", 0, Parameter.PRO_CHARACTER, 2, 0); 
// Add the table to the ProDataGraph meta data 
dgMetaData.addTable(doCustMD); 

For more information on the objects and methods for defining the schema (meta data) of temp-tables in a ProDataGraph, see Chapter 5, " Accessing Progress ProDataSets."


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095